package com.hu.zhcc.shiro.service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hu.zhcc.shiro.dao.Tj_TSportsItemLibraryMapper;
import com.hu.zhcc.shiro.entity.tj.TSportsItemLibrary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 运动项目库 服务实现类
 * </p>
 *
 * @author tj
 * @since 2021-06-23
 */
@Service
public class Tj_TSportsItemLibraryServiceImpl extends ServiceImpl<Tj_TSportsItemLibraryMapper, TSportsItemLibrary> implements Tj_TSportsItemLibraryService {
    @Autowired
    private Tj_TSportsItemLibraryMapper tjTSportsItemLibraryMapper;
    @Override
    public List<TSportsItemLibrary> queryAll() {
        return tjTSportsItemLibraryMapper.queryAll();
    }

    @Override
    public int insertlib(TSportsItemLibrary record) {
        String s = String.valueOf(Integer.parseInt(tjTSportsItemLibraryMapper.QueryCode())+1);
        record.setCode("YD000"+s);
        record.setCreateTime(new Date());
        return tjTSportsItemLibraryMapper.insertlib(record);
    }

    @Override
    public int updateByPrimaryKey(TSportsItemLibrary record) {
        record.setUpdateTime(new Date());
        return tjTSportsItemLibraryMapper.updateByPrimaryKey(record);
    }

    @Override
    public TSportsItemLibrary selectByPrimaryKey(Integer id) {
        return tjTSportsItemLibraryMapper.selectByPrimaryKey(id);
    }
}
